<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>消息</title>

    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>


</head>
<body>
<div id="blank" class="header" v-cloak>
    <div v-back.tapmode class="back"></div>
    <span class="title">消息</span>
    <span style="position:absolute;font-size:14px;right:15px;" v-myclick="deleteAll">全部清除</span>
</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script>
    apiready = function () {
        setBSImg();
        new Vue({
            el: '#blank',
            methods: {
                deleteAll: function () {
                    api.confirm({
                        title: '提示',
                        msg: '确认删除全部消息吗?',
                        buttons: ['确定', '取消']
                    }, function (ret) {
                        if (ret.buttonIndex == 1) {
                            showProgress();
                            var data = {
                                member_id: getPrefs('member_id')
                            };
                            var callback = function () {
                                api.sendEvent({
                                    name: 'getUnReadMsgCount',
                                    extra: {count: 0}
                                });
                                reloadFrame('message','message_frame');
                            };
                            pinet.post(URL.deleteAllMessage, data, callback);
                        }
                    });
                }
            }
        });
        api.parseTapmode();

        api.openFrame({
            name: 'message_frame',
            url: 'message_frame.html',
            rect: {
                x: 0,
                y: 60,
                w: api.winWidth,
                h: 'auto'
            },
            bounces: true
        });

        addListeners();
    };

    function addListeners() {
        api.addEventListener({
            name: 'viewappear'
        }, function () {
            onPageStart();
        });

        api.addEventListener({
            name: 'viewdisappear'
        }, function () {
            onPageEnd();
        });

        api.addEventListener({
            name: 'keyback'
        }, function () {
            onPageEnd();
            api.closeWin();
        });
    }

</script>
</html>
